//
//  XCIMSingerTableViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/9.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCIMSingerTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation XCIMSingerTableViewCell

- (void)dealloc {
    [_picUrlImageView release];
    [_nameLable release];
    [_descLable release];
    [_secModel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picUrlImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.picUrlImageView.userInteractionEnabled = YES;
        self.nameLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.descLable = [[UILabel alloc] initWithFrame:CGRectZero];
        
        [self.contentView addSubview:self.picUrlImageView];
        [self.contentView addSubview:self.nameLable];
        [self.contentView addSubview:self.descLable];
        
        [self.picUrlImageView release];
        [self.nameLable release];
        [self.descLable release];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.picUrlImageView.frame = CGRectMake(10, 15, self.bounds.size.width / 3 , self.bounds.size.height - 30);
    self.nameLable.frame = CGRectMake(20 + self.picUrlImageView.bounds.size.width, 30, self.bounds.size.width / 2 - 20, 21);
    self.nameLable.font = [UIFont systemFontOfSize:17];
    self.descLable.frame = CGRectMake(20 + self.picUrlImageView.bounds.size.width, 80, self.bounds.size.width * 2 / 3, 21);
    self.descLable.font = [UIFont systemFontOfSize:15];
    self.descLable.textColor = [UIColor colorWithWhite:0.800 alpha:1.000];
    
}

- (void)setSecModel:(XCSecDataModel *)secModel {
    if (_secModel != secModel) {
        [_secModel release];
        _secModel = [secModel retain];
    }
    
    [self.picUrlImageView sd_setImageWithURL:[NSURL URLWithString:secModel.picUrl]placeholderImage:[UIImage imageNamed:@"Image-p"]];
    self.nameLable.text = secModel.name;
    self.descLable.text = secModel.desc;
    
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
